home *** CD-ROM | disk | FTP | other *** search
- function init()
- {
- this.createEmptyMovieClip("mc_anim",Tardis.depth++);
- restart();
- }
- function destroy()
- {
- trace("-- kill the splashes");
- removeMovieClip("mc_anim");
- }
- function clearUp()
- {
- Tardis.TardisInterface.setObjProperty("isSplashAnimating",false);
- mc_anim.unloadMovie();
- delete onEnterFrame;
- delete onAnimationEnd;
- delete strLastSection;
- }
- function restart()
- {
- trace("restart()");
- Tardis.TardisInterface.setObjProperty("isSplashAnimating",true);
- Tardis.UsageData.addPageEntry(-1);
- nmCurrent = -1;
- next();
- onAnimationEnd = function()
- {
- next();
- };
- startSoundLoop();
- }
- function pauseAt(section_name)
- {
- if(section_name != strLastSection)
- {
- mc_anim.onLoad = function()
- {
- this.onLoad = null;
- this.pause = true;
- };
- load(section_name);
- }
- else
- {
- mc_anim.pause = true;
- mc_anim.gotoAndStop("still");
- }
- nmCurrent = Tardis.Sections.indexOf(section_name);
- }
- function playFrom(section_name)
- {
- nmCurrent = -1;
- mc_anim.onLoad = function()
- {
- this.onLoad = null;
- this.entering = true;
- };
- load(section_name);
- }
- function playStart(section_name)
- {
- mc_anim.onLoad = function()
- {
- this._parent.playStartWhenLoaded();
- this.onLoad = null;
- };
- load(section_name);
- }
- function resume()
- {
- Tardis.TardisInterface.setObjProperty("isSplashAnimating",true);
- this._visible = true;
- mc_anim.play();
- mc_anim.pause = false;
- }
- function restartSection()
- {
- mc_anim.gotoAndPlay("start");
- }
- function interrupt()
- {
- mc_anim.stop();
- }
- function hide()
- {
- interrupt();
- this._visible = false;
- }
- function show()
- {
- Tardis.TardisInterface.setObjProperty("isSplashAnimating",true);
- mc_anim.play();
- this._visible = true;
- }
- function load(section_name)
- {
- mc_anim.loadMovie(Tardis.ASSETS_FOLDER + "splash/" + section_name + ".swf");
- strLastSection = section_name;
- }
- function next()
- {
- Tardis.bottomNav.splashOff(Tardis.Sections.item(nmCurrent).id);
- nmCurrent++;
- if(nmCurrent >= Tardis.Sections.length)
- {
- nmCurrent = 0;
- }
- var section_name = Tardis.Sections.item(nmCurrent).id;
- if(section_name == null)
- {
- trace("splash : can\'t find index in Sections");
- }
- else
- {
- mc_anim.onLoad = function()
- {
- this._parent.playStartWhenLoaded();
- this.onLoad = null;
- };
- load(section_name);
- Tardis.bottomNav.splashOn(Tardis.Sections.item(nmCurrent).id);
- }
- }
- function playStartWhenLoaded()
- {
- mc_anim.onEnterFrame = function()
- {
- if(this.getBytesLoaded() == this.getBytesTotal())
- {
- this.gotoAndPlay("start");
- this.onEnterFrame = null;
- }
- };
- }
- function __onAnimationEnd()
- {
- onAnimationEnd();
- }
- function startSoundLoop()
- {
- trace("startSoundLoop()");
- if(!Tardis.mc_snd_splash_loop)
- {
- Tardis.createEmptyMovieClip("mc_snd_splash_loop",-10);
- Tardis.mc_snd_splash_loop.loadMovie(Tardis.ENGINE_FOLDER + "swf/bg_sound.swf");
- }
- else
- {
- fadeSoundLoop();
- }
- fadeSoundID = setInterval(monitorSoundLoop,40);
- }
- function monitorSoundLoop()
- {
- mcSnd = Tardis.mc_snd_splash_loop;
- if(mcSnd.getBytesLoaded() >= mcSnd.getBytesTotal() && mcSnd.getBytesTotal() > 4)
- {
- clearInterval(fadeSoundID);
- fadeSoundLoop();
- }
- }
- function fadeSoundLoop()
- {
- trace("fadeSoundLoop()");
- trace("mcSnd: " + mcSnd);
- trace("ncSnd.active: " + mcSnd.active);
- if(mcSnd.active == true)
- {
- return undefined;
- }
- var sndLoop = mcSnd.snd = new Sound(mcSnd);
- sndLoop.v = 0;
- sndLoop.setVolume(0);
- mcSnd.gotoAndStop("show");
- mcSnd.active = true;
- mcSnd.onEnterFrame = function()
- {
- with(this)
- {
- snd.v += 4;
- if(snd.v <= 100)
- {
- snd.setVolume(snd.v);
- }
- else
- {
- onEnterFrame = null;
- }
- }
- };
- }
- function endSoundLoop()
- {
- if(mcSnd.active != true)
- {
- return undefined;
- }
- mcSnd.onEnterFrame = function()
- {
- with(this)
- {
- snd.v -= 8;
- if(snd.v >= 0)
- {
- snd.setVolume(snd.v);
- }
- else
- {
- snd.stop();
- delete snd;
- gotoAndStop("hide");
- active = false;
- onEnterFrame = null;
- }
- }
- };
- }
-